package com.example.mylibrarybase.yumengmeng02.bean;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by heyi on 2016/5/18.
 */
public class UploadFile_02 implements Serializable {

    private String fileId;
    private String type;
    private String file_path;
    //file_path1 是小图
    private String file_path1;
    private String file_md5;
    private String remark;
    private String localPath;


    private boolean start = false;

    private boolean uploadComplete = false;

    public String getFileId() {
        return fileId;
    }

    public void setFileId(String fileId) {
        this.fileId = fileId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getFile_path() {
        return file_path;
    }

    public void setFile_path(String file_path) {
        this.file_path = file_path;
    }

    public String getFile_path1() {
        return file_path1;
    }

    public void setFile_path1(String file_path1) {
        this.file_path1 = file_path1;
    }

    public String getFile_md5() {
        return file_md5;
    }

    public void setFile_md5(String file_md5) {
        this.file_md5 = file_md5;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getLocalPath() {
        return localPath;
    }

    public void setLocalPath(String localPath) {
        this.localPath = localPath;
    }

    public boolean isStart() {
        return start;
    }


    public boolean isUploadComplete() {
        return uploadComplete;
    }

    public Map<String,String> getUploadData(){
        Map<String,String> map = new HashMap<String,String>();
        map.put("file_path",file_path);
        map.put("type",type);
        if(file_path1!=null){
            map.put("file_path1",file_path1);
        }
        if(remark!=null){
            map.put("remark",remark);
        }
        return map;
    }

    @Override
    public String toString() {
        return "UploadFile_02{" +
                "fileId='" + fileId + '\'' +
                ", type='" + type + '\'' +
                ", file_path='" + file_path + '\'' +
                ", file_path1='" + file_path1 + '\'' +
                ", file_md5='" + file_md5 + '\'' +
                ", remark='" + remark + '\'' +
                ", localPath='" + localPath + '\'' +
                ", start=" + start +
                ", uploadComplete=" + uploadComplete +
                '}';
    }

//    public void startUpload(Context context, final ProgressBar bar) {
//        bar.setVisibility(View.VISIBLE);
//        if (!start) {
//            start = true;
//           // InputStream stream = ImageUtil.compressImage(BitmapFactory.decodeFile(localPath));
//            Uri parse = Uri.parse(localPath);
//            LogUtils.i("上传图片的过程"+parse);
//            //上传图片的过程
//            InputStream stream = ImageUtil.compressImage(BitmapUtils.getResizeBitmap(context,parse,600 ,true));
//            String fileName = localPath.substring(localPath.lastIndexOf("/") + 1);
//            //把 图片的 地址传上去
//            LogUtils.i("云购上传图片的路径NetMan.UPLOAD_URL"+NetMan.UPLOAD_URL+stream+fileName);
//            HttpMultipartPost post = new HttpMultipartPost(context, NetMan.UPLOAD_URL,stream,fileName);
//            post.setCallBack(new HttpMultipartPost.CallBack() {
//                @Override
//                public void update(Integer i) {
//                    bar.setProgress(i);
//                }
//            });
//            post.setCallBackMsg(new HttpMultipartPost.CallBackMsg() {
//                @Override
//                public void msg(JSONObject msg) {
//                    bar.setVisibility(View.GONE);
//                    if (msg!=null){
//                        com.jac.login.utils.LogUtils.i("上传之后返回的消息原始数据"+msg);
//                        UploadFile_02 file = JSON.parseObject(msg.getString("data"), UploadFile_02.class);
//                        LogUtils.i("返回来的json 图片的 信息" + file+"想看的那个data里面的东西"+msg.getString("data"));
//
//                        if (file!=null){
//                            setFileId(file.getFileId());
//                            setFile_md5(file.getFile_md5());
//                            setFile_path(file.getFile_path());
//                            setFile_path1(file.getFile_path1());
//                            setType(file.getType());
//                            uploadComplete = true;
//                        }
//                    }
//                }
//            });
//            post.execute();
//        }
//
//
//    }
}